﻿ 
<!DOCTYPE html>  
<html>  
<head>  
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">  
    <meta name="keywords" content="人才简历">  
    <meta name="description" content="人才简历">  
    <title>人才简历管理</title>  
    
    <%@ include file="/WEB-INF/inc/default.jsp"%>
    <jsp:include page="/WEB-INF/inc/dic.jsp"/>   

</head>  
<body>  
    
      
    <table id="dg" title="人才简历管理" class="easyui-datagrid" style="height:555px"  
            url="/talent/cv/list.do"  
            toolbar="#toolbar" pagination="true"  
            rownumbers="true" fitColumns="true" loadMsg="正在查询,请稍候..." singleSelect="true">  

    </table>  
    <div id="toolbar">  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="add()">新增</a>  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="edit()">修改</a>  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="deletes()">删除</a>  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" plain="true" onclick="find()">查询</a>
    </div>  

    <div id="dlg" class="easyui-dialog" z-index=100 style="width:1100px;height:450px;padding:10px 20px"  
            closed="true" >  
            <iframe  id="addiframe"  src="/talent/cv/cvAdd.do" style="width:100%;height:90%"></iframe>
    </div>
    <div id="dlg_edit" class="easyui-dialog" z-index=100 style="width:1100px;height:500px"  
            closed="true" >  
            <iframe  src="" style="width:99%;height:99%"></iframe>
    </div>       
    <!-- query form窗体(开始) -->  
    <div id="dlg_query" style="display:none;">  
    	  <!--
        <div itemId="tab_panel" class="easyui-tabs" style="width:700px;height:300px">
    	        <div title="基本查询"  style="padding:10px"> 
                  <div class="ftitle">人才简历</div>  
                  <form itemId="fmquery" method="post" novalidate>                            
	                  		     <div class="fitem">  
                               <label style="width:100px">姓名(中/英):</label>                                            
                               <input name="bothName" class="easyui-box">                       
                             </div> 
	                  		     <div class="fitem">  
                               <label style="width:100px">联系方式:</label>                                            
                               <input name="contactDetails" class="easyui-box">                       
                             </div> 
                             <div class="fitem">  
                               <label style="width:100px">关键字:</label>                                            
                               <input name="keyword" class="easyui-box">                       
                             </div> 
	                  		     
	                </form>
	                
             </div>  
             <div title="高级查询"  style="padding:10px"> 
                  <div class="ftitle">人才简历</div>  
                  <form itemId="fmquery" method="post" novalidate>       
                        <table style="width:100%">
                             <tr>
                                  <td>一级行业</td>
                                  <td colspan="2"><input class="easyui-combobox" name="industry_parent" style="width:150px;"  data-options="data:__getCategoryByParant('INDUSTRY', 0),valueField:'id', textField:'codeNameCn', multiple:false,panelHeight:'auto',mode:'remote'
		                            	,onSelect: function(rec){                                  
		                            	      console.log(this);
                                        $('#cv_second_industry').combobox('loadData', __getCategoryByParant('INDUSTRY', rec.id));  
                                        $('#cv_second_industry').combobox('setValue',null);
                                        
                                    }
		                            	 "></td>
                                  <td>二级行业</td>
                                  <td  colspan="2"><input class="easyui-combobox" id="cv_second_industry" itemId="second_industry" name="industry" style="width:150px;"  data-options="data:{},valueField:'id', textField:'codeNameCn', multiple:false,panelHeight:'auto',mode:'remote' "></td>
                             </tr>
                             <tr>
                                  <td>一级职能</td>
                                  <td colspan="2"><input class="easyui-combobox" name="function_parent" style="width:150px;"  data-options="data:__getCategoryByParant('JOB', 0),valueField:'id', textField:'codeNameCn', multiple:false,panelHeight:'auto',mode:'remote' 
			                               ,onSelect: function(rec){              
                                           $('#cv_second_job').combobox('loadData', __getCategoryByParant('JOB', rec.id));  
                                           $('#cv_second_job').combobox('setValue',null);
                                       }
			                               "></td>
                                  <td>二级职能</td>
                                  <td colspan="2"><input class="easyui-combobox" id="cv_second_job" name="function" style="width:150px;"  data-options="data:{},valueField:'id', textField:'codeNameCn', multiple:false,panelHeight:'auto',mode:'remote' "></td>
                             </tr>
                             <tr>
                                  <td>现任公司</td>
                                  <td><input name="company" class="easyui-box"></td>
                                  <td>职位/岗位</td>
                                  <td><input name="title" class="easyui-box"></td>
                                  <td>职级</td>
                                  <td><input class="easyui-combobox" name="level" style="width:120px;"  data-options="data:__getCategory('JOBLEVEL'),valueField:'id', textField:'codeNameCn', multiple:false,panelHeight:'auto',mode:'remote' "></td>
                             </tr>
                             <tr>
                                  <td>技能</td>
                                  <td><input name="skill" class="easyui-box"></td>
                                  <td>年薪</td>
                                  <td><input class="easyui-combobox" name="currentSalary" style="width:200px;"  data-options="data:__getCategory('SALARY'),valueField:'id', textField:'codeNameCn', multiple:false,panelHeight:'auto',mode:'remote' "></td>
                                  <td>期望工作地</td>
                                  <td><input class="easyui-combobox" name="expectLocation" style="width:120px;"  data-options="data:__getCategory('LOCATION'),valueField:'id', textField:'codeNameCn', multiple:false,panelHeight:250,mode:'remote' "></td>
                             </tr>
                             <tr>
                                  <td>当前所在地</td>
                                  <td><input class="easyui-combobox" name="currentAddress" style="width:120px;"  data-options="data:__getCategory('LOCATION'),valueField:'id', textField:'codeNameCn', multiple:false,panelHeight:250,mode:'remote' "></td>
                                  <td>家庭地址</td>
                                  <td><input name="address" class="easyui-box"></td>
                                  <td>性别</td>
                                  <td><input class="easyui-combobox"  name="sex" style="width:50px;"  data-options="data:__getConstantCategory('SEX'),valueField:'code', textField:'value', multiple:false,panelHeight:'auto',mode:'remote' "></td>
                             </tr>
                             <tr>
                                  <td>年龄</td>
                                  <td><input class="easyui-combobox"  name="ageRange" style="width:100px;"  data-options="data:__getConstantCategory('AgeRange'),valueField:'code', textField:'value', multiple:false,panelHeight:'auto',mode:'remote' "></td>
                                  <td>学历</td>
                                  <td><input class="easyui-combobox" name="degree" style="width:120px;"  data-options="data:__getCategory('DEGREE'),valueField:'id', textField:'codeNameCn', multiple:false,panelHeight:'auto',mode:'remote' "></td>
                                  <td>工作年限</td>
                                  <td><input class="easyui-combobox"  name="workRange" style="width:100px;"  data-options="data:__getConstantCategory('WorkRange'),valueField:'code', textField:'value', multiple:false,panelHeight:'auto',mode:'remote' "></td>
                             </tr>
                             <tr>
                                  <td>人选类型</td>
                                  <td><input class="easyui-combobox" name="cvType" style="width:120px;"  data-options="data:__getCategory('CVTYPE'),valueField:'id', textField:'codeNameCn', multiple:false,panelHeight:'auto',mode:'remote' "></td>
                                  <td>人才编号</td>
                                  <td><input name="id" class="easyui-box"></td>
                                  <td>是否有附件</td>
                                  <td></td>
                             </tr>   
	                  		</table>      
	                </form>
	                
            </div>    
            
        </div>
        <div  style="text-align:center">  
                    <a href="javascript:void(0)" itemId="btn-query" class="easyui-linkbutton" iconCls="icon-ok" ">查询</a>  
                    <a href="javascript:void(0)" itemId="btn-close" class="easyui-linkbutton" iconCls="icon-cancel">关闭</a>  
        </div>    
        -->
    </div> 
    <!-- query form窗体(结束) -->  
 

    <script type="text/javascript">  
        var url;  
        var addWin;
        var editWin;
        var confWin;
        function add(){         	 
          //  $('#dlg').dialog('open').dialog('setTitle','新增人才简历');  
           // $('#fm').form('clear');  
             /*
             if (addWin){
                 addWin.window('open');
                 addWin.find('#addiframe').;
             }  
             else
             */
              addWin = $.window({
		      	   	title:"新增人才",
		      	   	url:"/talent/cv/cvAdd.do",
		      	   	isIframe:true,
		      	   	height:450,
		      	   	isCloseDestroy:true,
		      	   	modal:false,		      	   	
		      	   	width:1250,
		      	   	onComplete:function(jq,iframe){	
		      	   		   //console.log(this);
                     //console.log(iframe);		      	   		   	      	   		
		      	   		   var fwindow = $.window.util.getFrameWindow(iframe);		      	   		
		      	   		   var ijq = fwindow.jQuery;		
		      	   		   var curWin=this;   
		      	   		   
		      	   		   var curWin=this;
					
					           fwindow.closeWin=function(){
					           	   curWin.window('close');
				             };
				             fwindow.refresh=function(){
					           	   if(curWin.openerWin.refresh) curWin.openerWin.refresh();
				             };
		      	   		       	   		
		      	   		   ijq("#btn").click(function(){
		      	   		   	  //alert("这样绑定事件才靠谱!");
		      	   		   	  //保存成功后回调
		      	   		   	  
		      	   		   });
		      	   	}
		      	});
		      	addWin.openerWin=window;  
            
        }  
        
        function doEdit(id){
        	  editWin = $.window({
		      	   	title:"修改人才",
		      	   	url:"/talent/cv/cvEdit.do?type=UPDATE&cvId="+id,
		      	   	isIframe:true,
		      	   	isCloseDestroy:true,
		      	   	height:660,
		      	   	modal:false,
		      	   	minimizable : true,
		      	   	width:1250,
		      	   	onComplete:function(jq,iframe){		      	   		
		      	   		   var fwindow = $.window.util.getFrameWindow(iframe);		      	   		
		      	   		   var ijq = fwindow.jQuery;		
		      	   		   var curWin=this;   
		      	   		   
		      	   		   fwindow.closeWin=function(){
					           	   curWin.window('close');
				             };
				             fwindow.refresh=function(){
					           	   curWin.openerWin.refresh();
				             };
		      	   		       	   		
		      	   		   ijq("#btn").click(function(){
		      	   		   	  //alert("这样绑定事件才靠谱!");
		      	   		   	  //保存成功后回调
		      	   		   	  
		      	   		   });
		      	   	}
		      	});
		      	editWin.openerWin=window;
        }

        function edit(){  
            //var row = $('#dg').datagrid('getSelected');  
            var rows = $('#dg').datagrid('getSelections');
            if (!rows||rows.length==0){
            	 $.messager.alert('提示','请选择要修改的行','info');
            	 return;
            }
            if (!rows||rows.length>1){
            	 $.messager.alert('提示','不能选择多行','info');
            	 return;
            }
            if (rows){  
                //$('#dlg_edit').dialog('open').dialog('setTitle','修改人才简历'); 
                //$('#dlg_edit').find('iframe')[0].contentWindow.location.href="/talent/cv/cvEdit.do?cvId="+rows[0].id; 
                //$('#fm').form('load',rows[0]);  
                //$('#fm').form('load','/talent/cv/get.do?id='+rows[0].id);  
                //url = '/talent/cv/update.do';
                
                doEdit(rows[0].id);  
		      	
            }  
        }  
        function save(){    
        	 
        	  //if (!$('#fm').form('validate')) return; 
            $('#fm').form('submit',{  
                url: url,  
                onSubmit: function(){  
                	  
                    return $(this).form('validate');  
                },  
                success: function(result){  
                    var result = eval('('+result+')');  
                    console.log(result);
                    if (result.success == true){  
                        $.messager.alert('信息',result.msg,'info');  
                        $('#dlg').dialog('close');      // close the dialog  
                        $('#dg').datagrid('reload');    // reload the user data  
                    } else {  
                        $.messager.alert('错误',result.msg,'error');
                    }  
                }  
            });  
        }  
        function refresh(){        	 
        	  $('#dg').datagrid('reload');
        }	
        function deletes(){  
            var row = $('#dg').datagrid('getSelected');  
            
            var rows = $('#dg').datagrid('getSelections');  

            if (!rows||rows.length==0){
            	 $.messager.alert('提示','请选择要删除的行','info');
            	 return;
            }
            if (rows){  
                $.messager.confirm('重要提示','确定要删除?',function(r){  
                    if (r){  
                        $.post('/talent/cv/delete.do',{ids:getRecordArray(rows,'id').join(',')},function(result){  
                            if (result.success){  
                                $('#dg').datagrid('reload');    // reload the user data  
                            } else {  
                                 
                                $.messager.alert('错误',result.errorMsg,'error'); 
                            }  
                        },'json');  
                    }  
                });  
            }  
        }  
        function find(){  
              
                //$('#dlg_query').dialog('open').dialog('setTitle','查询');  
                
               // url = '/talent/cv/jsonlist.do';  
               if (confWin)
     	        confWin.window('open');
			    else confWin = $.window({
			    	title:"查询",
			    	tplRef:"dlg_query",//这个属性指定模板id
			    	height:400,
			    	width:730,	
			    	onComplete:function(){
			    		//窗口里面的初始化,最好是在这个事件里面进行
			    		var curWin=this;
			    		
			    		
			    		this.find('a[itemId="btn-query"]').click(function(){
			    		
			    			  if (!curWin.curForm) curWin.curForm=curWin.find('form[itemId="fmquery"]');
			    			  //console.log(curWin.curForm);
			    			  curWin.window('close');
			    			  var formdata=curWin.curForm.formToArray();   		 
		              curWin.openerWin.query(formdata);
			    		});
			    		this.find('a[itemId="btn-close"]').click(function(){
			    			  curWin.window('close');
			    	  });
			    	  
			    	  
			    	  this.find('div[itemId="tab_panel"]').tabs({
        	          onSelect: function(title,index){        	          
        	          	var tab=curWin.find('div[itemId="tab_panel"]').tabs('getTab', index);        	          
        	          	curWin.curForm=tab.find('form[itemId="fmquery"]');  
        	          	//console.log(curWin.curForm);
        	          	        	          	
        	          }
             }); 
			    	  
			    		
			    	}
			    });
			    confWin.openerWin=window;
              
        } 
       /* 	
        function query(){  
                
                //var aa=$('#fm_query').formSerialize();
                var formdata=$('#fm_query').formToArray();
                //var dd= JSON.stringify(cc); 
                
                if (!$('#fm_query').form('validate')) return; 
                $('#dg').datagrid({
	                  queryParams: array2json(formdata)
                });
               $('#dlg_query').dialog('close');
              
        }*/
       function query(formdata){  
                
                $('#dg').datagrid({
	                  queryParams: array2json(formdata)
                });
              
        }
        
        //生成grid的字段,需要字典的自动转换
        $('#dg').datagrid({
        	   pageSize:20,
        	   columns:[[
        	   	   {field:'id',title:'人才编号', width:80}
        	   	   ,{field:'attachmentId',title:'有无简历', width:80,
        	   	   	   formatter: function(value,row,index){
        	   	   	    	if (value) {
									       return '<font color=red>有</font>';
								       } else {
									      return '无';
							        	}        	   		      	
        	   		      }
        	   	   	}
        	   	   ,{field:'cvName',title:'姓名', width:100}
        	   	   ,{field:'cvNameEn',title:'英文名', width:100}
        	   	   ,{field:'recomId',title:'是否推荐',hidden:true, width:100,
        	   	   	    formatter: function(value,row,index){
        	   	   	    	if (value) {
									       return '<font color=red>已推荐</font>';
								       } else {
									      return '未推荐';
							        	}        	   		      	
        	   		      },hidden:true
        	   	   	}
        	   	   ,{field:'recomDt',title:'推荐时间',hidden:true, width:100,hidden:true}        	   	   
        	   	   ,{field:'sex',title:'性别', width:50,
        	   		      formatter: function(value,row,index){
        	   		      	return __getConstantCategoryCodeValue('SEX', value);
        	   		      }
        	   	     }
        	   	   ,{field:'birthday',title:'出生日期', width:100}
        	   	   ,{field:'mobile',title:'手机', width:100}
        	   	   ,{field:'tel',title:'电话', width:100}        	   	   
        	   	   ,{field:'email',title:'邮件', width:100}
        	   	   ,{field:'position',title:'职位', width:100,hidden:true}
        	   	   ,{field:'company',title:'现任公司', width:100}        	   	   
        	   	   ,{field:'industry',title:'行业', width:100,
        	   		      formatter: function(value,row,index){
        	   		      	return __getCategroyCodeValue('INDUSTRY', value);
        	   		      }
        	   	     }
        	   	   ,{field:'function',title:'职能', width:100,
        	   		      formatter: function(value,row,index){
        	   		      	return __getCategroyCodeValue('JOB', value);
        	   		      }
        	   	     }
        	   	   ,{field:'level',title:'职级', width:100,
        	   		      formatter: function(value,row,index){
        	   		      	return __getCategroyCodeValue('JOBLEVEL', value);
        	   		      }
        	   	     }
        	   	   
        	   	   ,{field:'degree',title:'学历', width:100,
        	   		      formatter: function(value,row,index){
        	   		      	return __getCategroyCodeValue('DEGREE', value);
        	   		      }
        	   	     }
        	   	   ,{field:'workYear',title:'工作年限', width:100}        	   	   
        	   	   
        	   	   ,{field:'expectLocation',title:'期望工作地点', width:100,
        	   		      formatter: function(value,row,index){
        	   		      	return __getCategroyCodeValue('LOCATION', value);
        	   		      }
        	   	     }
        	   	   ,{field:'married',title:'婚姻状况', width:100,
        	   		      formatter: function(value,row,index){
        	   		      	return __getCategroyCodeValue('MARRIED', value);
        	   		      },hidden:true
        	   	     }
        	   	   ,{field:'registerLocation',title:'户口所在地', width:100,
        	   		      formatter: function(value,row,index){
        	   		      	return __getCategroyCodeValue('LOCATION', value);
        	   		      },hidden:true
        	   	     }
        	   	   ,{field:'address',title:'详细家庭地址', width:100,hidden:true}
        	   	   ,{field:'postCode',title:'邮编', width:100,hidden:true}  
        	   	   ,{field:'resumeInformer',title:'简历线人', width:100,hidden:true}
        	   	   ,{field:'resumeDt',title:'简历录入时间', width:100,hidden:true}
        	   	   ,{field:'cvType',title:'人才类型', width:100,
        	   		      formatter: function(value,row,index){
        	   		      	return __getCategroyCodeValue('CVTYPE', value);
        	   		      },hidden:true
        	   	     }
        	   	   ,{field:'cvStatus',title:'简历状态', width:100,
        	   		      formatter: function(value,row,index){
        	   		      	if (value == 'F') {
									        return "完整简历";
								        }
								          return "仅基本信息";
        	   		      },hidden:true
        	   		  }
        	   	   ,{field:'cvFrom',title:'简历来源', width:100,
        	   		      formatter: function(value,row,index){
        	   		      	return __getConstantCategoryCodeValue('CvFrom', value);
        	   		      },hidden:true
        	   	     }
        	   	   //,{field:'baseCreator',title:'基本信息提供者', width:100}
        	   	   ,{field:'creator',title:'创建人', width:100,hidden:true}
        	   	   ,{field:'createDt',title:'创建时间', width:100,hidden:true}
        	   	   ,{field:'modifier',title:'修改人', width:100,hidden:true}
        	   	   ,{field:'modifiedDt',title:'修改时间', width:100,hidden:true}
        	   	   //,{field:'homeBackEn',title:'homeBackEn', width:100}
        	   	   //,{field:'logo',title:'照片', width:100}
        	   	   ,{field:'oldcompany',title:'曾任公司', width:100}
        	   	   ,{field:'currentAddress',title:'当前所在地', width:100}
        	   	   //,{field:'companyId',title:'现任公司id', width:100}
        	   	   ,{field:'resumeCreator',title:'简历录入人', width:100,hidden:true}
        	   	   //,{field:'oldcompanyId',title:'曾任公司id', width:100}
        	   	   ,{field:'cvTag',title:'简历标志', width:100,
        	   		      formatter: function(value,row,index){
        	   		      	return __getCategroyCodeValue('CVTAG', value);
        	   		      },hidden:true
        	   	     }
        	   	   ,{field:'cvFlLevel',title:'外语水平', width:100,
        	   		      formatter: function(value,row,index){
        	   		      	return __getConstantCategoryCodeValue('CvFLLevel', value);
        	   		      }
        	   	     }
        	   	   ,{field:'nationality',title:'国籍', width:100,
        	   		      formatter: function(value,row,index){
        	   		      	return __getCategroyCodeValue('NATIONALITY', value);
        	   		      },hidden:true
        	   	     }
        	   	   
        	   	   ,{field:'integrity',title:'完整度', width:100,
        	   		      formatter: function(value,row,index){
        	   		      	return __getConstantCategoryCodeValue('CvIntegrity', value);
        	   		      },hidden:true
        	   	     }
        	   	   //,{field:'isDelete',title:'删除标志', width:100}
        	   	  // ,{field:'deleteDt',title:'删除时间', width:100}
        	   	
        	   	
        	   ]]
        	   ,onDblClickRow: function(rowIndex, rowData){
        	    	//$('#dlg').dialog('open').dialog('setTitle','修改人才简历');                  
                //$('#fm').form('load','/talent/cv/get.do?id='+rowData.id);  
                //url = '/talent/cv/update.do';    
                doEdit(rowData.id);    	    	
        	    }
        }); 
        //完成-生成grid的字段
        
        
        
       
        
     
        
    </script>  


    
     

     
     
     
</body>  
</html>